const state = {
    token: '',
    userInfo: {}
}

const getters = {
    //暴露token
    token(_state) {
        return _state.token
    },
    //暴露userInfo
    userInfo(_state) {
        return _state.userInfo
    }
}

const mutations = {
    //扭转token
    mutationsToken(_state, _token) {
        _state.token = _token
    },
    //扭转userInfo
    mutationsUserInfo(_state, _userInfo) {
        _state.userInfo = _userInfo
    }

}

const actions = {
    userAct({ commit }, _userInfo) {
        //登录成功之后将用户信息加密保存
        commit('mutationsUserInfo', data)
    }
}

export default {
    namespaced: true,
    state,
    getters,
    actions,
    mutations
}